package day4.zy6;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class Test1 {
    public static void main(String[] args) {
        FileInputStream fileInputStream =null;
        try {
            fileInputStream = new FileInputStream("D:\\AAA\\新建文本文档.txt");
            File file1 = new File("D:\\BBB\\新建文本文档.txt");
            file1.createNewFile();
            byte[]bytes = new byte[fileInputStream.available()];
            FileOutputStream fileOutputStream = new FileOutputStream("D:\\BBB\\新建文本文档.txt");
            fileOutputStream.write(bytes,0,fileInputStream.read(bytes));
            fileOutputStream.flush();
            System.out.println("复制成功");
        } catch (java.io.IOException e) {
            e.printStackTrace();
        }finally {
            try {
                fileInputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
